/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

@Entity
public class Product implements Serializable {

    @Id
    private String code;
    private String name;
    private String status;				//Available, Discontinued (deleted)
    private String description;
    private Double price;
    private Double weight; 		//200kg per volume in BOM
    private Integer capacityPerHour;
    @OneToMany(cascade = {CascadeType.ALL}, fetch = FetchType.EAGER)
    private List<MaterialRequired> materialRequired = new ArrayList<MaterialRequired>();
    
    public Product() {
        
    }
    
    public Product(String code, String name, String status, String description, Double price, Double weight, Integer capacityPerHour, List<MaterialRequired> materialRequired) {
        this.code = code;
        this.name = name;
        this.status = status;
        this.description = description;
        this.price = price;
        this.weight = weight;
        this.capacityPerHour = capacityPerHour;
        this.materialRequired = materialRequired;
    }

    /**
     * @return the code
     */
    public String getCode() {
        return code;
    }

    /**
     * @param code the code to set
     */
    public void setCode(String code) {
        this.code = code;
    }

    /**
     * @return the name
     */
    public String getName() {
        return name;
    }

    /**
     * @param name the name to set
     */
    public void setName(String name) {
        this.name = name;
    }

    /**
     * @return the status
     */
    public String getStatus() {
        return status;
    }

    /**
     * @param status the status to set
     */
    public void setStatus(String status) {
        this.status = status;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return the price
     */
    public Double getPrice() {
        return price;
    }

    /**
     * @param price the price to set
     */
    public void setPrice(Double price) {
        this.price = price;
    }

    /**
     * @return the weight
     */
    public Double getWeight() {
        return weight;
    }

    /**
     * @param weight the weight to set
     */
    public void setWeight(Double weight) {
        this.weight = weight;
    }

    /**
     * @return the capacityPerHour
     */
    public Integer getCapacityPerHour() {
        return capacityPerHour;
    }

    /**
     * @param capacityPerHour the capacityPerHour to set
     */
    public void setCapacityPerHour(Integer capacityPerHour) {
        this.capacityPerHour = capacityPerHour;
    }

    /**
     * @return the materialRequired
     */
    public List<MaterialRequired> getMaterialRequired() {
        return materialRequired;
    }

    /**
     * @param materialRequired the materialRequired to set
     */
    public void setMaterialRequired(List<MaterialRequired> materialRequired) {
        this.materialRequired = materialRequired;
    }
}
